package com.mall.admin.service;

import com.mall.commons.utils.PageResult;
import com.mall.domain.SmsCouponHistory;
import com.mall.interface1.api.SmsCouponHistoryApi;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SmsCouponHistoryService {

    @DubboReference
    private SmsCouponHistoryApi smsCouponHistoryApi;

    //根据优惠券id，使用状态，订单编号分页获取领取记录
    public PageResult list(Long couponId, String orderSn, Integer pageNum, Integer pageSize, Integer useStatus) {

        //返回领取记录
        List<SmsCouponHistory> schList = smsCouponHistoryApi.list(couponId,orderSn,pageNum,pageSize,useStatus);
        //返回领取记录总数
        Integer count = smsCouponHistoryApi.count(couponId,orderSn,pageNum,pageSize,useStatus);
        PageResult pageResult = new PageResult(pageNum,pageSize,count,schList);

        return pageResult;

    }
}
